<?php
   
   class MyDB extends SQLite3
   {
      function __construct()
      {  
      $user=$_POST['user'];
      $pwd=$_POST['pwd'];
      if($pwd!="123456"){
          echo "密码错误";
          return;
      }
      $this->open('students.db');
      }
   }
   $db = new MyDB();
   if(!$db){
      echo $db->lastErrorMsg();
   } else {
      echo "查询完毕，以下是查询结果。。。";
   }
   $name=$_POST['name'];
    $sql =<<<EOF
SELECT * from students where 学号='{$user}';
EOF;
    }
      
   echo "<table border='1'>
<tr>
<th>学号</th>
</tr>";

$ret = $db->query($sql);
   while($row = $ret->fetchArray(SQLITE3_ASSOC) ){
      echo "<tr>";
      echo "<td>". $row['学号'] ."</td>\n";
      echo "</tr>";
   }
   echo "</table>";
   $db->close();
   if($ret){
header("Location: index1.html");
}
?>